package org.hxyjs.utils.messageFactory;

import org.hxyjs.entity.Parents;
import org.hxyjs.utils.MailHtmlUtils;
import org.hxyjs.vo.MailUser;

public class ParentsMessageFactory implements MakeMessage{
    public String[] getMessage(MailUser mailUser, String opDeatil){
        Parents parents = (Parents)mailUser;
        String subject = null;
        StringBuilder mailMessage = new StringBuilder();
        String opDeatils[] = opDeatil.split(";");
        switch (opDeatils[0]){
            case "addOrder":
                mailMessage.append("亲爱的家长"+parents.getPname()+":<br>");
                mailMessage.append("下单成功,购买家长");

                mailMessage.append("");
                subject = "亲爱的家长"+parents.getPname() + "您的的方案有新的会员购买";
                break;
            case "addParents":
                mailMessage.append("亲爱的家长"+parents.getPname()+":<br>");
                mailMessage.append("注册成功");
                mailMessage.append("<a href=\"http://localhost:8080/#/public/activate/"+parents.getPno()+"\">激活</a>");
                subject = "亲爱的家长"+parents.getPname()+"注册成功";//邮件标题

                break;
            case "cancelOrder": break;
            case "timeout": break;
            case "sendCode":
                mailMessage.append("");
                subject = "亲爱的家长"+parents.getPname() + "找回密码验证码为"+opDeatils[1];
                break;
            default:break;
        }
        String [] mail = new String[2];
        mail[0] = subject;
        mail[1] = MailHtmlUtils.initHtml(mailMessage.toString());
        return mail;
    }
}
